package neu.soft.feignclient;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import neu.soft.vo.ResultBean;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component
@Slf4j
public class WarehouseFeignClientFallBackFactory implements FallbackFactory<WarehouseFeignClient> {
    @Override
    public WarehouseFeignClient create(Throwable throwable) {
        return new WarehouseFeignClient() {
            /**
             * @return
             */
            @Override
            public ResultBean showAllInventory() {
                log.info(throwable.getMessage());
                return ResultBean.error(500,throwable.getMessage());
            }

            /**
             * @param map
             * @return
             */
            @Override
            public ResultBean queryInventoryByCode(Map<String, Object> map) {
                log.info(throwable.getMessage());
                return ResultBean.error(500,throwable.getMessage());
            }
        };
    }
}
